package conductores;

import aima.search.framework.HeuristicFunction;

public class FuncionDeBondad2 implements HeuristicFunction {

	int distancia;// distancia recorrida en el estado inicial

	public FuncionDeBondad2(Board board) {

		distancia = board.getDistanciaTotal();

	}

	public int getHeuristicValue(Object state) {

		Board board = (Board) state;
		int distRecorrida = board.getDistanciaTotal();
		int numConductoresActivos = board.getConductores().size();
		int ConductoresEnHora = board.llegadaEnHora();
		double valorD = (double) distRecorrida / (double) distancia;
		double valorP = 1 - ((double) ConductoresEnHora / (double) numConductoresActivos);
		valorP = valorP*valorP;

		int result = (int) ((valorD + valorP) * 100000);
		return result;
	}

}